package com.youlu.campus.website.controller;

import com.youlu.campus.common.base.QResult;
import com.youlu.campus.website.entity.WebsiteConfig;
import com.youlu.campus.website.service.WebsiteConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 官网配置
 */
@RestController
@RequestMapping("/website/config")
public class WebsiteConfigController {

    @Autowired
    private WebsiteConfigService websiteConfigService;

    /**
     * 新增 官网配置
     *
     * @param jumpConfig
     * @return
     */
    @PostMapping("/save")
    public QResult<WebsiteConfig> save(@RequestBody WebsiteConfig jumpConfig) {
        WebsiteConfig save = websiteConfigService.save(jumpConfig);
        return QResult.success(save);
    }

    /**
     * 查询 官网配置
     *
     * @param
     * @return
     */
    @GetMapping("/find-one")
    public QResult<WebsiteConfig> findOne() {
        return QResult.success(websiteConfigService.findOne());
    }
}